from flask import Flask, jsonify
from HitbotInterface import HitbotInterface
import time

app = Flask(__name__)

# 创建机械臂实例
robot_id = 20
robot = HitbotInterface(robot_id)
robot.net_port_initial()

@app.route('/arm/status', methods=['GET'])
def get_arm_status():
    robot.get_scara_param()

    if robot.move_flag:
        return jsonify({'status': 'work'})
    else:
        return jsonify({'status': 'notwork'})

if __name__ == '__main__':
    app.run('0.0.0.0', port=5004)